<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
  defined('_JEXEC') or die('Retricted Access');
  
  JHTML::_('behavior.tooltip');
?>

<form name="adminForm" action="index.php" method="post">
    <div style="width:100%;">
		<table width="100%">
        <tr>
      
        <td valign="top">
        <table>
			<tr>
				<td align="left" width="100%">
					<?php echo JText::_( 'Filter' ); ?>:
					<input type="text" name="search" id="search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />					
                    <button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
					<button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
				</td>
				<td nowrap="nowrap">
					<?php 
					$count_ele = 0;	
					if(isset($this->lists['filter']) && $this->lists['filter']){?>
						<?php foreach ($this->lists['filter'] as $row){?>
							<?php $count_ele++; ?>
							<?php echo $row;?>
						<?php 
						if ($count_ele==4)
						{
							echo '</td>';
							echo '</tr>';
							echo '<tr>';
							echo '<td align="left" width="100%">&nbsp';
							echo '</td>';
							echo '<td nowrap="nowrap">';
							$count_ele = 0;
						}
						}?>
					<?php }?>
					
					<select name="approved" onchange="form.submit()">		
						<option value="" <?php if($this->lists['approved']==-1) echo 'selected';?>><?php echo '--'.JText::_('Approved').'--';?></option>				
						<option value="0" <?php if($this->lists['approved']==0) echo 'selected';?>><?php echo JText::_('No')?></option>						
						<option value="1" <?php if($this->lists['approved']==1) echo 'selected';?>><?php echo JText::_('Yes')?></option>
					</select>
					<select name=published onchange="form.submit()">		
						<option value="" <?php if($this->lists['published']==-1) echo 'selected';?>><?php echo '--'.JText::_('Published').'--';?></option>				
						<option value="0" <?php if($this->lists['published']==0) echo 'selected';?>><?php echo JText::_('No')?></option>						
						<option value="1" <?php if($this->lists['published']==1) echo 'selected';?>><?php echo JText::_('Yes')?></option>
					</select>
				</td>

			</tr>
		</table>
       
		<table class="adminlist">
        	<thead>
				<tr>
					<th width="20">
						<?php echo JText::_( 'NUM' ); ?>
					</th>
					<th width="20">
						<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->items); ?>);" />
					</th>
					<th>            		
            			<?php echo JHTML::_('grid.sort',   JText::_('Job Seeker'), 'rs.name',@$this->lists['order_Dir'], @$this->lists['order']); ?>
            		</th> 
            		<th>            		
            			<?php echo JHTML::_('grid.sort',   JText::_('Username'), 'rs.username',@$this->lists['order_Dir'], @$this->lists['order']); ?>
            		</th> 
					<th>            		
            			<?php echo JHTML::_('grid.sort',   JText::_('E-Mail'), 'rs.email',@$this->lists['order_Dir'], @$this->lists['order']); ?>
            		</th> 
            		
					<th>            		
            			<?php echo JHTML::_('grid.sort',   JText::_('User ID'), 'rs.id',@$this->lists['order_Dir'], @$this->lists['order']); ?>
            		</th> 
            		<th>            		
            			<?php echo JHTML::_('grid.sort',   JText::_('Approved'), 'a.approved',@$this->lists['order_Dir'], @$this->lists['order']); ?>
            		</th>
            		<th>            		
            			<?php echo JHTML::_('grid.sort',   JText::_('Published'), 'a.published',@$this->lists['order_Dir'], @$this->lists['order']); ?>
            		</th>	
            		<th>            		
            			<?php echo JText::_('Action'); ?>
            		</th> 				
				</tr>
			</thead>
			<tbody>
        	<?php
        	$items = $this->items;
        	
        	for($i = 0, $orderNo=0, $n = count($items); $i < $n; $i++, $orderNo++){
        		$item = $items[$i];
        		$item->checked_out = 0;
				$checked 	= JHTML::_('grid.checkedout',   $item, $i );
				$status_img = $item->approved ? 'tick.png' : 'publish_x.png';
				$status_task = $item->approved ? 'unapprove' : 'approve';
				$alt 	= $item->approved ? JText::_( 'Approved' ) : JText::_( 'Non-approved' );
        		JFilterOutput::objectHtmlSafe($item);
        		$item->published 	= $item->published?"Published":"Unpublished";
        		if($i==0) $isFirst = true;
        		else $isFirst = false;
        		if($i==$n-1) $isLast = true;
        		else $isLast = false;
        		?>
        		<tr class="row<?php echo $i%2; ?>">
            		<td align="center"><?php echo $this->pagination->getRowOffset( $i );  ?></td>            		
            		<td align="center"><?php echo $checked; ?></td>
            		<td>
            			<a href="<?php echo JRoute::_( 'index.php?option='. $this->lists['option'] .'&view=jacandidates&task=user&cid[]='.$item->id ); ?>">
            				<?php echo $item->name; ?>
            			</a>
            		</td>
            		<td><?php echo $item->username; ?></td>
            		<td><?php echo $item->email; ?></td>
            		   
            		<td><?php echo $item->id; ?></td>   
            		<td align="center">
            			<a href="javascript:void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $status_task;?>')">
						<img src="images/<?php echo $status_img;?>" width="16" height="16" border="0" alt="<?php echo $alt; ?>" /></a>
            		</td> 
            		<td align="center">
            			<?php echo $item->published?>
            		</td> 
            		<td align="center">
            			<a href="<?php echo JRoute::_( 'index.php?option='. $this->lists['option'] .'&view=jacandidates&task=resume&cid[]='.$item->id ); ?>">
            				<!--<img src="components/<?php echo  $this->lists['option']; ?>/views/styles/icons/icon-32-preview.png" title="<?php echo JText::_('View Profile'); ?>" alt="<?php echo JText::_('View Profile'); ?>">-->
            				<?php echo JText::_('View Resume'); ?>
            			</a>
            		</td>                
            	</tr>
        	<?php
        		
			}
        	?>
        	<tbody>
        	<tfoot>
				<tr>
					<td colspan="9">
						<?php echo $this->pagination->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
		</table>
        </td>
        </tr>
        </table>
	</div>
	<input type="hidden" name="filter_approved" value="<?php echo JRequest::getVar('filter_approved'); ?>" />
	<input type="hidden" name="filter_duration" value="<?php echo JRequest::getVar('filter_duration'); ?>" />	
	<input type="hidden" name="option" value="<?php echo $this->lists['option']; ?>" />
	<input type="hidden" name="view" value="jacandidates" />
    <input type="hidden" name="task" value="" />
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
	<?php echo JHTML::_( 'form.token' ); ?>	
 </form>
